package guoan.repository;

import guoan.domain.Customer;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface CustomerRepository extends PagingAndSortingRepository<Customer, Long>,
		JpaSpecificationExecutor<Customer> {

	/**
	 * 登陆
	 * 
	 * @param uname
	 *            登陆帐户
	 * @param upass
	 *            登陆密码
	 * @return Long
	 */
	Customer findByCustomerLoginNameAndCustomerPassword(String uname, String upass);

	@Modifying
	@Query(value = "UPDATE customer SET customer_password = ?1", nativeQuery = true)
	void changePSW(String psw);

}
